package com.cqrcb.cloud.service.quota;

import com.cqrcb.cloud.entity.api.req.Q;
import com.cqrcb.cloud.entity.api.res.R;
import com.cqrcb.cloud.entity.quota.MultiQuotaCtrlMarketMain;
import com.cqrcb.cloud.entity.quota.io.MultiQuotaCtrlMarketMainIO;

/**
* MultiQuotaCtrlMarketMainService
*
* @author yangxueyong
* @date 2021-05-31 01:41:40
*/
public interface MultiQuotaCtrlMarketMainService {

    /**
     * 额度入库
     * @param record
     * @return
     */
    boolean saveFinancialProductQuota(MultiQuotaCtrlMarketMain record);

    /**
     * 修改数据(推荐使用)
     * @param record
     */
    int updateByPrimaryKeySelective(MultiQuotaCtrlMarketMain record);
    /**
     * 扣减金融产品额度
     * @param q
     * @return
     */
    R deductionFinancialProductQuota(Q<MultiQuotaCtrlMarketMainIO> q);

    /**
     * 计算额度并记录到redis
     * @param record
     * @return
     */
    MultiQuotaCtrlMarketMain deductionQuota(MultiQuotaCtrlMarketMainIO record);

    /**
     * 记录额度到缓存中
     * @param multiQuotaCtrlMarketMain
     * @return
     */
    MultiQuotaCtrlMarketMain saveMultiQuotaCtrlMarketMainToRedis(MultiQuotaCtrlMarketMain multiQuotaCtrlMarketMain);

    /**
     * 从redis中取出额度
     * @param record
     * @return
     */
    MultiQuotaCtrlMarketMain getMultiQuotaCtrlMarketMainForRedis(MultiQuotaCtrlMarketMainIO record);

    /**
     * 从db中取出额度
     * @param record
     * @return
     */
    MultiQuotaCtrlMarketMain getMultiQuotaCtrlMarketMainForDB(MultiQuotaCtrlMarketMainIO record);

}
